
<style type="text/css">
    .wi80-BFB {
        width: 80%
    }

    .wi40-BFB {
        width: 40%
    }

    .seauii {
        padding: 7px 10px;
        margin-right: 10px
    }

    .he110 {
        height: 110px
    }

    .di-bl {
        display: inherit
    }
    .ncap-account-container-list li{
        width: 100%;
    }
    .adderss-add{
        overflow-y: scroll;
    }
</style>
<div class="adderss-add">
    <div class="ner-reac ol_box_4" style="visibility: visible; position: fixed; z-index: 500; width: 100%; height:100%">
        <div class="box-ct">
            <div class="box-header">
                <!-- <a href="" class="box-close"></a> -->
            </div>
            <form action="{:U('Admin/User/doSavePlotter')}" method="post" onSubmit="return checkForm(this)">
                <table width="90%" border="0" cellspacing="0" cellpadding="0">
                    <input name="user_id" type="hidden" value="{:I('id')}"/>
                    <tr>
                        <td style="width: 180px">
                            <div>&nbsp;</div>
                        </td>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top" >策划师等级：</td>
                        <td>
                            <select name="level_id" id="suppliers_id" class="small form-control">
                                <foreach name="user_level" item="v" key="k">
                                    <option value="{$v['id']}"
                                    <if condition="$v['id'] eq $userInfo['leveal_id'] ">selected="selected"</if>
                                    >
                                    {$v['title']}
                                    </option>
                                </foreach>
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top">好性格：</td>
                        <td>
                            <ul class="ncap-account-container-list">
                                <volist name="user_character" id="vo">
                                    <li>
                                        <label><input class="checkbox" name="master_character[]" value="{$vo.id}" type="checkbox" <?php if(is_array($userInfo['master_character']) && in_array($vo['id'],$userInfo['master_character'])) echo 'checked="checked"'; ?>
                                            >{$vo.title}</label>
                                    </li>
                                </volist>

                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top">坏性格：</td>
                        <td>
                            <ul class="ncap-account-container-list">
                                <volist name="user_character" id="vo">
                                    <li>
                                        <input class="checkbox" name="bad_character" value="{$vo.id}" type="radio" <if condition="$vo['id'] eq $userInfo['bad_character'] ">checked="checked"</if> >{$vo.title}
                                    </li>
                                </volist>

                            </ul>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                        <td>
                            <div>&nbsp;</div>
                        </td>
                    </tr>

                    <tr>
                        <td align="right" valign="top">二消费金额：</td>
                        <td>
                            <input type="text" name="total_money" id="total_money" class="input-txt" value="{$userInfo.total_money}">
                        </td>
                    </tr>



                    <tr style="height:60px">
                        <td class="pa-50-0">&nbsp;</td>
                        <td align="right">
                            <button type="submit" style="padding: 4px 16px;cursor: pointer;"><span id="sub_sub">保存</span></button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/pc_common.js"></script>

<script>
    function checkForm(that) {
        var bad = $("input[type='radio']:checked").val();

        var error = '';
        $.each($('input:checkbox:checked'),function(){
           var good = $(this).val();
           if(good == bad){
               error = '坏性格不能包含在好性格中<br/>';
           }
        });


        if (error) {
            layer.alert(error, {icon: 2});
            return false;
        }

        var url = $(that).attr('action');

        $('#sub_sub').html('数据提交中....');


        $.ajax({
            type: "POST",
            url: url,
            data: $(that).serialize(),// 你的formid
            dataType:'json',
            success: function (data) {
               console.log(data);
               if(data.status == 1){
                   $('#sub_sub').html('操作成功,2秒后关闭');
                   layer.alert('操作成功', {icon: 1},function () {
                        layer.closeAll();
                   });

               }else{
                   layer.alert('添加失败，重新尝试', {icon: 2});
                   $('#sub_sub').html('提交');
               }
            }
        });

        return false;

    }
</script>

